package com.cs.study.homework._0315;

import com.cs.study.homework._0314.queue.MyArrayQueue;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;

public class Demo3 {
    public static void main(String[] args) {
        Collection<MyUser> collection = new ArrayList<>();
        collection.add(new MyUser("zs",12));
        collection.add(new MyUser("zs",12));
        collection.add(new MyUser("ww",62));
        collection.add(new MyUser("ls",42));
        collection.add(new MyUser("ls",42));
        collection.add(new MyUser("sq",33));

        Collection<MyUser> newCollection = new ArrayList<>();
        for (MyUser myUser : collection) {
            if (!newCollection.contains(myUser)){
                newCollection.add(myUser);
            }
        }

        System.out.println(newCollection);



    }
}

@Data
@NoArgsConstructor
@AllArgsConstructor
class MyUser{
    private String name;
    private int age;

}
